|
|
|
|
|
|
|
File errors are one of the oldest types of errors that can occur in your application and are listed in Table 16.1. These types of errors usually enable you to give the user a chance to correct the problem. |
|
|
|
|
| TABLE 16.1. GENERAL VISUAL BASIC FILE ERRORS. | | Error Code | Error Message | | 52 | Bad filename or number | | 53 | File not found | | 54 | Bad file mode | | 55 | File already open | | 58 | File already exists | | 59 | Bad record length | | 61 | Disk full | | 62 | Input past end of file | | 63 | Bad record number | | 64 | Bad filename | | 67 | Too many files | | 74 | Can't rename with different drive | | 75 | Path/File access error | | 76 | Path not found |
|
|
|
|
|
|
Its important to know that these errors will not occur when you are accessing data within a database. Most of the time, you can create an error routine that anticipates these errors, prompts the user, and then returns the operation that caused the error. In some cases, you will not be able to prompt the user and retry the operation; you would then display a message giving the user the information or at least an error number that will help her identify and, hopefully, fix the problem. |
|
|
|
|
|
|
|
|
Another group of older common error is caused by problems that occur with the physical media or hardware on the user's computer. Printers that don't print, disk drives without disks, and disconnected communication ports are the most common examples of physical errors. These errors might or might not be fixed quickly by the user. Usually, you can report the error to the user, wait for them to fix the problem, and then either continue with the process or exit the application. As an example, if the application is trying to copy a file to a disk and there is no disk in the drive, all you need to do is tell the user |
|
|
|
|
|